<?xml version="1.0" encoding="utf-8"?>
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:blueonionsoftware-com:bloget:runtime:data">
  <text>Many .Net Forms methods (like ShowDialog) accept an IWin32Window interface. This allows one to pass an unmanaged window handle to a managed class for whatever purpose the method needs (window parenting in the case of ShowDialog). Here's a implementation of IWin32Window in managed C++

&lt;code&gt;
    __gc class Win32Window : public System::Windows::Forms::IWin32Window
    {
    public:
        Win32Window(System::IntPtr handle)
        {
            _handle = handle;
        }

        __property virtual System::IntPtr get_Handle()
        {
            return _handle;
        }

    private:
        // Must implement in managed C++. Also, operator=() not allowed in
        // managed C++
        Win32Window() { };
        Win32Window(const Win32Window&amp; rhs) { };
        System::IntPtr _handle;
    };
&lt;/code&gt;</text>
  <last_update>2007-10-04T00:52:31.7880806Z</last_update>
  <source_title />
  <source_link />
  <comments />
  <references />
  <attachments />
</Content>